package org.notabug.jalgateam.jalga.common;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import org.notabug.jalgateam.jalga.common.handler.ConfigHandler;
import org.notabug.jalgateam.jalga.common.handler.JALGAEventHandler;
import org.notabug.jalgateam.jalga.common.lib.LibCreativeTab;
import org.notabug.jalgateam.jalga.common.lib.LibStrings;
import org.notabug.jalgateam.jalga.common.registry.BlockRegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.common.config.Configuration;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@Mod(modid = LibStrings.MODID, name = LibStrings.NAME, version = LibStrings.VERSION, dependencies = LibStrings.DEPENDENCIES)

public class JALGA {
    @Mod.Instance ("JALGA")
    public static JALGA instance;

    // Proxies
    @SidedProxy(clientSide = "ClientProxy", serverSide = "CommonProxy")
    public static CommonProxy proxy;

    public static JALGAEventHandler JALGAEvents;
    public static CreativeTabs tabJALGA = new LibCreativeTab();
    public static ConfigHandler configHandler;
    public static final Logger log = LogManager.getLogger("JALGA");

    // Pre init
    @Mod.EventHandler
    public static void preInit (FMLPreInitializationEvent event)
    {
        log.info("JALGA entered preInit...");
        // Config
        configHandler.config = new Configuration(event.getSuggestedConfigurationFile());
        configHandler.init();

        // Registry
        BlockRegistry.init();
        proxy.registerClientHandlers();

        //MCMOD.INFO
        ModMetadata metadata = event.getModMetadata();
        LibStrings.modinfo(metadata);
    }

    // Init
    @Mod.EventHandler
    public static void init (FMLInitializationEvent event)
    {
        log.info("JALGA entered Init...");
        //Rendering

    }

    // Post init
    @Mod.EventHandler
    public static void postInit (FMLPostInitializationEvent event)
    {
        log.info("JALGA entered postInit...");

        log.info("JALGA finished loading");
    }
}
